package com.chen.controller.admin;

import com.chen.pojo.Court;
import com.chen.pojo.Release;
import com.chen.service.release.ReleaseService;
import com.chen.util.DataGridViewResult;
import com.chen.vo.CourtVo;
import com.chen.vo.ReleaseVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin/release")
public class AfterReleaseController {

    @Resource
    private ReleaseService releaseService;


    /**
     * 查询球场列表
     * @param releaseVo
     * @return
     */
    @RequestMapping("/list")
    public DataGridViewResult list(ReleaseVo releaseVo){
        //设置分页信息
        PageHelper.startPage(releaseVo.getPage(),releaseVo.getLimit());
        //调用分页查询方法
        List<Release> releases = releaseService.list(releaseVo);
        //创建分页对象
        PageInfo<Release> pageInfo = new PageInfo<Release>(releases);
        //返回数据
        return new DataGridViewResult(pageInfo.getTotal(),pageInfo.getList());
    }
}
